package com.example.threaddemo;

public class PrintOddNumbers implements Runnable {
    private int start;
    private int end;

    public PrintOddNumbers(int start, int end) {
        this.start = start;
        this.end = end;
    }

    @Override
    public void run() {
        for (int i = start; i <= end; i++) {
            if (i % 2 != 0) {
                System.out.println(i);
            }
        }
    }

    public static void main(String[] args) {
        PrintOddNumbers task1 = new PrintOddNumbers(1, 50);
        PrintOddNumbers task2 = new PrintOddNumbers(51, 100);

        Thread thread1 = new Thread(task1);
        Thread thread2 = new Thread(task2);

        thread1.start();
        thread2.start();
    }
}
